<?xml version="1.0"?>
<!-- Author: Gary Chen -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:variable name="mask" select="'###,##0.00'"/>
<xsl:variable name="mask_int" select="'###,##0'"/>
<xsl:variable name="running_total" select="0"/>
<xsl:template match="/">
	<fo:root>
		<fo:layout-master-set>
			<fo:simple-page-master master-name="job_quote"
			margin-top="0.5in" margin-bottom="0.5in" margin-left="0.5in" margin-right="0.5in">
				<fo:region-before extent="5.8in"/>
				<fo:region-body extent="7.0in" margin-top="5.4in" margin-bottom="1.3in"/>
                                <fo:region-after extent="1.3in"/>

			</fo:simple-page-master>
		</fo:layout-master-set>
		<fo:page-sequence master-name="job_quote">
			<fo:static-content flow-name="xsl-region-before">
				<xsl:apply-templates select="Job"/>
			</fo:static-content>
			<fo:static-content font-size="12pt" font-family="Times" flow-name="xsl-region-after">
                            <fo:block space-after="10pt" border-bottom-style="double" border-bottom-width="thick" border-bottom-color="black"></fo:block>
<!--
                            <fo:block>
                            Approved by: __________________________________ Quote Valid Until: _____________________
                            </fo:block>
-->
                            <fo:block>
                            Approved by: __________________________________
                            </fo:block>
                            <fo:block>
                            Notes: _____________________________________________________________________________
                            </fo:block>
                            <fo:block font-size="6pt">
                            Pioneer agrees that the products will be as described in this quote. Pioneer warrants that any materials furnished meet standard industry specifications makes no claim herein of suitability of service use by Buyer. Buyer shall not at any time, even after the expiration or termination of this quote, use or disclose herein information to any person for any purpose other than to execute a contract from this quote.  Without Pioneer&apos;s prior written consent, Buyer and persons under Buyer&apos;s control shall not disclose to any third party, information it receives from Pioneer in connection with the above project specific quote.  Possession of this proposal does aggregate Pioneer&apos;s standards and conditions.
                            </fo:block>
                            <fo:block text-align="center">Page <fo:page-number/></fo:block>
                        </fo:static-content>
			<fo:flow flow-name="xsl-region-body">				
				<fo:table>
					<fo:table-column column-width="28mm"/>
					<fo:table-column column-width="8mm"/>
					<fo:table-column column-width="120mm"/>
					<fo:table-column column-width="17mm"/>
<!-- Frank Chen requested removal of totals
					<fo:table-column column-width="33mm"/>
-->
					<fo:table-body  font-family="Times" font-size="10pt">
						<fo:table-row font-size="12pt">
							<fo:table-cell>
								<fo:block font-weight="bold">Item Num</fo:block>
							</fo:table-cell>	
							<fo:table-cell>
								<fo:block font-weight="bold">Qty</fo:block>
							</fo:table-cell>	
							<fo:table-cell>
								<fo:block font-weight="bold">Description</fo:block>
							</fo:table-cell>
		
							<fo:table-cell>
								<fo:block font-weight="bold" text-align="end">Price</fo:block>
							</fo:table-cell>
<!-- Frank Chen requested removal of totals
							<fo:table-cell>
								<fo:block font-weight="bold" text-align="end">Total Sale</fo:block>
							</fo:table-cell>
-->
						</fo:table-row>
						<xsl:apply-templates select="Job/ItemList">
							<!-- todo: find out how to sort -->
							<!--xsl:sort data-type="String" select="Container/Id"/-->
						</xsl:apply-templates>
<!-- Frank Chen requested removal of grand totals
						<fo:table-row>
							<fo:table-cell number-columns-spanned="5">
								<fo:block text-align="end">
									<fo:leader leader-length="60mm" leader-pattern="rule"
								             rule-thickness="2pt" color="green"/>
								</fo:block>
							</fo:table-cell>
						</fo:table-row>						
						<fo:table-row>
							<fo:table-cell number-columns-spanned="3">
							</fo:table-cell>
							<fo:table-cell>
								<fo:block font-weight="bold">Total:</fo:block>
							</fo:table-cell>	
							<fo:table-cell>
								<fo:block font-size="10pt" text-align="end"><xsl:value-of select="format-number(//Total,$mask)"/></fo:block>
							</fo:table-cell>
						</fo:table-row>	
-->
					</fo:table-body>
				</fo:table>
			</fo:flow>

		</fo:page-sequence>
	</fo:root>
</xsl:template>

<xsl:template match="Job">
   <fo:table>
     <fo:table-column column-width="3.5in"/>
     <fo:table-column column-width="3.5in"/>
     <fo:table-body font-family="Times" font-size="10pt">
       <fo:table-row>
         <fo:table-cell>
           <fo:block>
             <fo:external-graphic src="logo.jpg"/>
           </fo:block>
         </fo:table-cell>
         <fo:table-cell>
           <fo:block space-before="26pt" text-align="end">
             <fo:inline font-size="18pt" font-style="italic">Pioneer Industries, Inc.</fo:inline>
           </fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell number-columns-spanned="2">
           <fo:block space-before="10pt" space-after="5pt" border-bottom-style="double" border-bottom-width="thick" border-bottom-color="black"></fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell number-columns-spanned="2">
           <fo:block font-style="italic" font-size="9pt" text-align="end">
             3325 S. Garfield Ave. Commerce CA 90040 &#8226; (323) 888-8873 &#8226; (800) 338-9468 &#8226; FAX: (323) 888-9515 &#8226; www.pioneerind.com
           </fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell number-columns-spanned="2">         
           <fo:block space-before="10pt" space-after="10pt" font-size="12pt" text-align="center">
              <fo:inline text-decoration="underline">CONFIDENTIAL JOB QUOTATION</fo:inline>
           </fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell>
           <fo:block>
             <fo:inline font-weight="bold">Quote: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="QuoteNum"/></fo:inline>             
           </fo:block>
         </fo:table-cell>
         <fo:table-cell>
           <fo:block>
             <fo:inline font-weight="bold">Quote Date: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="Date"/></fo:inline>
           </fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell>
           <fo:block space-before="10pt">
             <fo:inline font-weight="bold">Sales Rep: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="SalesRep"/></fo:inline>
           </fo:block>
         </fo:table-cell>
         <fo:table-cell>
           <fo:block space-before="10pt">
             <fo:inline font-weight="bold">Builder: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="BuilderName"/></fo:inline>
           </fo:block>
         </fo:table-cell>
       </fo:table-row>       
       <fo:table-row>
         <fo:table-cell>
           <fo:block>
             <fo:inline font-weight="bold">Regional SM: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="RegSalesMan"/></fo:inline>
           </fo:block>
         </fo:table-cell>
         <fo:table-cell>
           <fo:block>
             <fo:inline font-weight="bold">City: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="BuilderCity"/>&#160;&#160;</fo:inline>
             <fo:inline font-weight="bold">State: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="BuilderState"/></fo:inline>
           </fo:block>
         </fo:table-cell>
       </fo:table-row> 
       <fo:table-row>
         <fo:table-cell>
           <fo:block>
             &#160;
           </fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell>
           <fo:block>
             <fo:inline font-weight="bold">Job Name: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="JobName"/></fo:inline>
           </fo:block>
         </fo:table-cell>
         <fo:table-cell>
           <fo:block>
             <fo:inline font-weight="bold">Type: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="Type"/></fo:inline>
           </fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell>           
           <fo:block>
             <fo:inline font-weight="bold">Address: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="Address"/></fo:inline>
           </fo:block>           
         </fo:table-cell>
         <fo:table-cell>
           <fo:block>
             <fo:inline font-weight="bold">Status: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="Status"/></fo:inline>
           </fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell>           
           <fo:block>
             <fo:inline font-weight="bold">City: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="City"/>&#160;&#160;</fo:inline>
             <fo:inline font-weight="bold">State: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="State"/>&#160;&#160;</fo:inline>
             <fo:inline font-weight="bold">Zip: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="Zip"/></fo:inline>
           </fo:block>           
         </fo:table-cell>
         <fo:table-cell>
           <fo:block>
             <fo:inline font-weight="bold">Terms: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="Terms"/></fo:inline>
           </fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell number-columns-spanned="2">
           <fo:block>&#160;&#160;</fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell>
           <fo:block>
             <fo:inline font-weight="bold">Ship Date: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="ShipDate"/></fo:inline>
           </fo:block>
         </fo:table-cell>
         <fo:table-cell>
           <fo:block>
             <fo:inline font-weight="bold">Quote Valid Until: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="ExpirationDate"/></fo:inline>
           </fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell number-columns-spanned="2">
           <fo:block space-before="10pt">
             <fo:inline font-weight="bold">Contractor: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="ContractorName"/></fo:inline>
           </fo:block>
           <fo:block>
             <fo:inline font-weight="bold">Contact: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="ContractorContact"/></fo:inline>
           </fo:block>
           <fo:block>
             <fo:inline font-weight="bold">Address: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="ContractorAddress"/></fo:inline>
           </fo:block>
           <fo:block>
             <fo:inline font-weight="bold">City: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="ContractorCity"/>&#160;&#160;</fo:inline>
             <fo:inline font-weight="bold">State: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="ContractorState"/>&#160;&#160;</fo:inline>
             <fo:inline font-weight="bold">Zip: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="ContractorZip"/></fo:inline>
           </fo:block>
           <fo:block>
             <fo:inline font-weight="bold">Phone: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="ContractorPhone"/>&#160;&#160;</fo:inline>
             <fo:inline font-weight="bold">Fax: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="ContractorFax"/></fo:inline>
           </fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell number-columns-spanned="2">
           <fo:block space-before="10pt">
             <fo:inline font-weight="bold">Supplier: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="SupplierName"/></fo:inline>
           </fo:block>
           <fo:block>
             <fo:inline font-weight="bold">Contact: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="SupplierContact"/></fo:inline>
           </fo:block>
           <fo:block>
             <fo:inline font-weight="bold">Address: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="SupplierAddress"/></fo:inline>
           </fo:block>
           <fo:block>
             <fo:inline font-weight="bold">City: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="SupplierCity"/>&#160;&#160;</fo:inline>
             <fo:inline font-weight="bold">State: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="SupplierState"/>&#160;&#160;</fo:inline>
             <fo:inline font-weight="bold">Zip: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="SupplierZip"/></fo:inline>
           </fo:block>
           <fo:block>
             <fo:inline font-weight="bold">Phone: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="SupplierPhone"/>&#160;&#160;</fo:inline>
             <fo:inline font-weight="bold">Fax: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="SupplierFax"/></fo:inline>
           </fo:block>
         </fo:table-cell>
       </fo:table-row>
       <fo:table-row>
         <fo:table-cell number-columns-spanned="2">
           <fo:block space-before="10pt">
             <fo:inline font-weight="bold">Notes: </fo:inline>
             <fo:inline font-style="normal"><xsl:value-of select="Notes"/></fo:inline>
           </fo:block>
         </fo:table-cell>
       </fo:table-row>  
       <fo:table-row>
         <fo:table-cell number-columns-spanned="2">
           <fo:block space-before="10pt" border-bottom-style="double" border-bottom-width="thick" border-bottom-color="black"></fo:block>
         </fo:table-cell>
       </fo:table-row>
     </fo:table-body>

   </fo:table>
</xsl:template>

<xsl:template match="ItemList">
	<xsl:for-each select="JobItem">
		<fo:table-row>
			<fo:table-cell>
				<fo:block><xsl:value-of select="ItemNum"/></fo:block>
			</fo:table-cell>	
			<fo:table-cell>
				<fo:block><xsl:value-of select="ItemQty"/></fo:block>
			</fo:table-cell>	
			<fo:table-cell>
				<fo:block><xsl:value-of select="ItemDescription"/></fo:block>
			</fo:table-cell>	
			<fo:table-cell>
				<fo:block text-align="end">$<xsl:value-of select="format-number(ItemPrice,$mask)"/></fo:block>
			</fo:table-cell>
<!-- Frank Chen requested removal of totals
			<fo:table-cell>
				<fo:block text-align="end"><xsl:value-of select="format-number(Amount,$mask)"/></fo:block>
			</fo:table-cell>
-->
		</fo:table-row>
	</xsl:for-each>
</xsl:template>


</xsl:stylesheet>
